@datapos/datapos-development 0.3.127 → 0.3.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Data Positioning Development Library
2
2
 
3
3
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=data-positioning_datapos-development&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=data-positioning_datapos-development)
4
+ <span><!-- OWASP_BADGE_START -->[![OWASP](https://img.shields.io/badge/OWASP-passed-ForestGreen)](https://data-positioning.github.io/test-lib/dependency-check-reports/dependency-check-report.html)<!-- OWASP_BADGE_END --></span>
4
5
  [![npm version](https://img.shields.io/npm/v/@datapos/datapos-development.svg)](https://www.npmjs.com/package/@datapos/datapos-development)
5
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
6
7
 
@@ -64,9 +65,11 @@ The OWASP Dependency Check Report identifies known vulnerabilities in project de
64
65
  The following table lists top-level production and peer dependencies only. All dependency licenses (including transitive dependencies) have been recursively verified to conform to Apache-2.0, CC0-1.0, MIT, or n/a. Developers cloning this repository should independently verify dev and optional dependencies; users of the uploaded library are covered by these checks.
65
66
 
66
67
  <!-- DEPENDENCY_LICENSES_START -->
68
+
67
69
  | Name | Type | Installed | Latest | Latest Modified |
68
70
  | :---------------------- | :--: | :-------: | :-----: | :----------------------- |
69
71
  | @datapos/datapos-shared | MIT | 0.3.252 | 0.3.252 | 2025-11-25T16:48:28.532Z |
72
+
70
73
  <!-- DEPENDENCY_LICENSES_END -->
71
74
 
72
75
  ### Bundle Analysis Report
@@ -1,9 +1,9 @@
1
- import { exec as h } from "node:child_process";
1
+ import { exec as b } from "node:child_process";
2
2
  import { promises as t } from "node:fs";
3
- import { nanoid as b } from "nanoid";
4
- import { promisify as $ } from "node:util";
5
- const v = ["createObject", "dropObject", "removeRecords", "upsertRecords"], O = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"], w = $(h);
6
- async function j() {
3
+ import { nanoid as $ } from "nanoid";
4
+ import { promisify as O } from "node:util";
5
+ const S = ["createObject", "dropObject", "removeRecords", "upsertRecords"], v = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"], y = O(b);
6
+ async function k() {
7
7
  try {
8
8
  console.info("🚀 Building configuration...");
9
9
  const e = JSON.parse(await t.readFile("package.json", "utf8")), o = JSON.parse(await t.readFile("config.json", "utf8"));
@@ -18,26 +18,26 @@ async function C(e) {
18
18
  const o = {};
19
19
  async function i(s, r) {
20
20
  console.info(`âš™ī¸ Processing directory '${s}'...`);
21
- const d = [], a = s.substring(`public/${e}`.length);
22
- o[a] = d;
23
- for (const c of r) {
24
- const l = `${s}/${c}`;
21
+ const d = [], c = s.substring(`public/${e}`.length);
22
+ o[c] = d;
23
+ for (const a of r) {
24
+ const l = `${s}/${a}`;
25
25
  try {
26
26
  const f = await t.stat(l);
27
27
  if (f.isDirectory()) {
28
- const p = await t.readdir(l), u = { childCount: p.length, name: `${c}`, typeId: "folder" };
29
- d.push(u), await i(l, p);
28
+ const u = await t.readdir(l), p = { childCount: u.length, name: `${a}`, typeId: "folder" };
29
+ d.push(p), await i(l, u);
30
30
  } else {
31
- const p = { id: b(), lastModifiedAt: f.mtimeMs, name: c, size: f.size, typeId: "object" };
32
- d.push(p);
31
+ const u = { id: $(), lastModifiedAt: f.mtimeMs, name: a, size: f.size, typeId: "object" };
32
+ d.push(u);
33
33
  }
34
34
  } catch (f) {
35
- throw new Error(`Unable to get information for '${c}' in 'buildPublicDirectoryIndex'. ${String(f)}`);
35
+ throw new Error(`Unable to get information for '${a}' in 'buildPublicDirectoryIndex'. ${String(f)}`);
36
36
  }
37
37
  }
38
- d.sort((c, l) => {
39
- const f = c.typeId.localeCompare(l.typeId);
40
- return f === 0 ? c.name.localeCompare(l.name) : f;
38
+ d.sort((a, l) => {
39
+ const f = a.typeId.localeCompare(l.typeId);
40
+ return f === 0 ? a.name.localeCompare(l.name) : f;
41
41
  });
42
42
  }
43
43
  const n = await t.readdir(`public/${e}`);
@@ -46,23 +46,23 @@ async function C(e) {
46
46
  console.error("❌ Error building public directory index.", o);
47
47
  }
48
48
  }
49
- async function k() {
49
+ async function J() {
50
50
  try {
51
51
  console.info("🚀 Building connector configuration...");
52
52
  const e = JSON.parse(await t.readFile("package.json", "utf8")), o = JSON.parse(await t.readFile("config.json", "utf8")), i = await t.readFile("src/index.ts", "utf8");
53
53
  let n = !1, s = !1;
54
- const r = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, d = [...i.matchAll(r)].filter((c) => c[1] == null && c[2] !== "constructor").map((c) => {
55
- const l = c[2];
56
- return n = n || v.includes(l), s = s || O.includes(l), l;
54
+ const r = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, d = [...i.matchAll(r)].filter((a) => a[1] == null && a[2] !== "constructor").map((a) => {
55
+ const l = a[2];
56
+ return n = n || S.includes(l), s = s || v.includes(l), l;
57
57
  });
58
58
  d.length > 0 ? console.info(`â„šī¸ Implements ${d.length} operations.`) : console.warn("âš ī¸ Implements no operations.");
59
- const a = s && n ? "bidirectional" : s ? "source" : n ? "destination" : "unknown";
60
- a && console.info(`â„šī¸ Supports ${a} usage.`), e.name != null && (o.id = e.name), o.operations = d, o.usageId = a, e.version != null && (o.version = e.version), await t.writeFile("config.json", JSON.stringify(o, void 0, 4), "utf8"), console.info("✅ Connector configuration built.");
59
+ const c = s && n ? "bidirectional" : s ? "source" : n ? "destination" : "unknown";
60
+ c && console.info(`â„šī¸ Supports ${c} usage.`), e.name != null && (o.id = e.name), o.operations = d, o.usageId = c, e.version != null && (o.version = e.version), await t.writeFile("config.json", JSON.stringify(o, void 0, 4), "utf8"), console.info("✅ Connector configuration built.");
61
61
  } catch (e) {
62
62
  console.error("❌ Error building connector configuration.", e);
63
63
  }
64
64
  }
65
- async function J() {
65
+ async function A() {
66
66
  try {
67
67
  console.info("🚀 Building context configuration...");
68
68
  const e = JSON.parse(await t.readFile("package.json", "utf8")), o = JSON.parse(await t.readFile("config.json", "utf8")), i = await t.readFile("src/index.ts", "utf8"), n = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, s = [...i.matchAll(n)].filter((r) => r[1] == null && r[2] !== "constructor").map((r) => r[2]);
@@ -71,7 +71,7 @@ async function J() {
71
71
  console.error("❌ Error building context configuration.", e);
72
72
  }
73
73
  }
74
- async function R() {
74
+ async function F() {
75
75
  try {
76
76
  console.info("🚀 Building presenter configuration...");
77
77
  const e = JSON.parse(await t.readFile("package.json", "utf8")), o = JSON.parse(await t.readFile("config.json", "utf8")), i = await t.readFile("src/index.ts", "utf8"), n = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, s = [...i.matchAll(n)].filter((r) => !r[1] && r[2] !== "constructor").map((r) => r[2]);
@@ -80,7 +80,7 @@ async function R() {
80
80
  console.error("❌ Error building context configuration.", e);
81
81
  }
82
82
  }
83
- async function A(e = "./") {
83
+ async function R(e = "./") {
84
84
  try {
85
85
  console.info("🚀 Bumping version...");
86
86
  const o = JSON.parse(await t.readFile(`${e}package.json`, "utf8"));
@@ -94,10 +94,10 @@ async function A(e = "./") {
94
94
  console.error("❌ Error bumping package version.", o);
95
95
  }
96
96
  }
97
- function F(e) {
97
+ function D(e) {
98
98
  console.error(`❌ ${e} script not implemented.`);
99
99
  }
100
- async function D() {
100
+ async function P() {
101
101
  const e = "<!-- DEPENDENCY_LICENSES_START -->", o = "<!-- DEPENDENCY_LICENSES_END -->";
102
102
  try {
103
103
  const i = (await t.readFile("./licenses.md", "utf8")).trim(), n = await t.readFile("./README.md", "utf8"), s = n.indexOf(e), r = n.indexOf(o);
@@ -114,37 +114,40 @@ async function I() {
114
114
  const e = "<!-- OWASP_BADGE_START -->", o = "<!-- OWASP_BADGE_END -->";
115
115
  try {
116
116
  const i = JSON.parse(await t.readFile("./dependency-check-reports/dependency-check-report.json", "utf-8")), n = { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 };
117
- for (const u of i.dependencies)
118
- if (u.vulnerabilities != null)
119
- for (const g of u.vulnerabilities) {
120
- const m = g.severity?.toLowerCase() ?? "unknown";
121
- m in n ? n[m]++ : n.unknown++;
117
+ for (const g of i.dependencies)
118
+ if (g.vulnerabilities != null)
119
+ for (const m of g.vulnerabilities) {
120
+ const w = m.severity?.toLowerCase() ?? "unknown";
121
+ w in n ? n[w]++ : n.unknown++;
122
122
  }
123
123
  const s = {
124
- critical: { color: "red", label: "Critical" },
125
- high: { color: "orange", label: "High" },
126
- moderate: { color: "yellow", label: "Moderate" },
127
- low: { color: "green", label: "Low" },
128
- unknown: { color: "lightgrey", label: "Unknown" }
129
- }, r = [];
130
- for (const [u, g] of Object.entries(n)) {
131
- if (g === 0) continue;
132
- const m = s[u], y = `https://img.shields.io/badge/OWASP%20${m.label}-${g}-${m.color}`;
133
- r.push(`[![OWASP ${m.label}](${y})](./dependency-check-reports/dependency-check-report.html)`);
134
- }
135
- const d = Object.values(n).reduce((u, g) => u + g, 0);
136
- console.info(`✅ Total vulnerabilities found: ${d}`), console.info(
124
+ critical: { color: "D32F2F", label: "critical" },
125
+ high: { color: "EF6C00", label: "high" },
126
+ moderate: { color: "F9A825", label: "moderate" },
127
+ low: { color: "AFB42B", label: "low" },
128
+ unknown: { color: "757575", label: "unknown" }
129
+ }, r = Object.values(n).reduce((g, m) => g + m, 0);
130
+ console.info(`✅ Total vulnerabilities found: ${r}`), console.info(
137
131
  ` Critical: ${n.critical}, High: ${n.high}, Moderate: ${n.moderate}, Low: ${n.low}, Unknown: ${n.unknown}`
138
132
  );
139
- const a = await t.readFile("./README.md", "utf8"), c = a.indexOf(e), l = a.indexOf(o);
140
- (c === -1 || l === -1) && (console.error("❌ OWASP badge markers not found in README.md."), process.exit(1));
141
- const f = r.join(" "), p = a.substring(0, c + e.length) + f + a.substring(l);
133
+ const d = JSON.parse(await t.readFile("config.json", "utf8")), c = [];
134
+ if (r === 0)
135
+ c.push(`[![OWASP](https://img.shields.io/badge/OWASP-passed-4CAF50)](https://data-positioning.github.io/${d.id}/dependency-check-reports/dependency-check-report.html)`);
136
+ else
137
+ for (const [g, m] of Object.entries(n)) {
138
+ if (m === 0) continue;
139
+ const w = s[g], h = `https://img.shields.io/badge/OWASP-${m}%20${w.label}-${w.color}`;
140
+ c.push(`[![OWASP](${h})](https://data-positioning.github.io/${d.id}/dependency-check-reports/dependency-check-report.html)`);
141
+ }
142
+ const a = await t.readFile("./README.md", "utf8"), l = a.indexOf(e), f = a.indexOf(o);
143
+ (l === -1 || f === -1) && (console.error("❌ OWASP badge markers not found in README.md."), process.exit(1));
144
+ const u = c.join(" "), p = a.substring(0, l + e.length) + u + a.substring(f);
142
145
  await t.writeFile("README.md", p, "utf8"), console.info("✅ OWASP dependency check badges inserted into README.md");
143
146
  } catch (i) {
144
147
  console.error("❌ Error updating README with OWASP badges:", i), process.exit(1);
145
148
  }
146
149
  }
147
- async function P() {
150
+ async function M() {
148
151
  try {
149
152
  console.info("🚀 Sending deployment notice...");
150
153
  const e = JSON.parse(await t.readFile("config.json", "utf8")), o = {
@@ -158,28 +161,28 @@ async function P() {
158
161
  console.error("❌ Error sending deployment notice.", e);
159
162
  }
160
163
  }
161
- async function M() {
164
+ async function T() {
162
165
  try {
163
166
  console.info("🚀 Synchronising with GitHub....");
164
167
  const e = JSON.parse(await t.readFile("package.json", "utf8"));
165
- await w("git add ."), await w(`git commit -m "v${e.version}"`), await w("git push origin main:main"), console.info(`✅ Synchronised version ${e.version} with GitHub.`);
168
+ await y("git add ."), await y(`git commit -m "v${e.version}"`), await y("git push origin main:main"), console.info(`✅ Synchronised version ${e.version} with GitHub.`);
166
169
  } catch (e) {
167
170
  console.error("❌ Error synchronising with GitHub.", e);
168
171
  }
169
172
  }
170
- async function T(e, o) {
173
+ async function _(e, o) {
171
174
  try {
172
175
  console.info("🚀 Uploading directory to R2....");
173
176
  async function i(s, r, d) {
174
- for (const a of d) {
175
- const c = `${s}/${a}`, l = `${r}/${a}`;
176
- if ((await t.stat(c)).isDirectory()) {
177
- const p = await t.readdir(c);
178
- await i(c, l, p);
177
+ for (const c of d) {
178
+ const a = `${s}/${c}`, l = `${r}/${c}`;
179
+ if ((await t.stat(a)).isDirectory()) {
180
+ const u = await t.readdir(a);
181
+ await i(a, l, u);
179
182
  } else {
180
- console.info(`âš™ī¸ Uploading '${s}/${a}'...`);
181
- const p = `wrangler r2 object put "datapos-sample-data-eu/${r}/${a}" --file="${s}/${a}" --jurisdiction=eu --remote`, u = await w(p);
182
- if (u.stderr) throw new Error(u.stderr);
183
+ console.info(`âš™ī¸ Uploading '${s}/${c}'...`);
184
+ const u = `wrangler r2 object put "datapos-sample-data-eu/${r}/${c}" --file="${s}/${c}" --jurisdiction=eu --remote`, p = await y(u);
185
+ if (p.stderr) throw new Error(p.stderr);
183
186
  }
184
187
  }
185
188
  }
@@ -189,7 +192,7 @@ async function T(e, o) {
189
192
  console.error("❌ Error uploading directory to R2.", i);
190
193
  }
191
194
  }
192
- async function _() {
195
+ async function W() {
193
196
  try {
194
197
  console.info("🚀 Uploading module configuration....");
195
198
  const e = JSON.parse(await t.readFile("config.json", "utf8")), o = e.id, i = {
@@ -203,19 +206,19 @@ async function _() {
203
206
  console.error("❌ Error uploading module configuration.", e);
204
207
  }
205
208
  }
206
- async function U(e) {
209
+ async function B(e) {
207
210
  try {
208
211
  console.info("🚀 Uploading module to R2...");
209
212
  const i = `v${JSON.parse(await t.readFile("package.json", "utf8")).version}`;
210
213
  async function n(s, r = "") {
211
214
  const d = await t.readdir(s, { withFileTypes: !0 });
212
- for (const a of d) {
213
- const c = `${s}/${a.name}`, l = r ? `${r}/${a.name}` : a.name;
214
- if (!a.isDirectory()) {
215
- const f = `${e}_${i}/${l}`.replace(/\\/g, "/"), p = a.name.endsWith(".js") ? "application/javascript" : a.name.endsWith(".css") ? "text/css" : "application/octet-stream";
215
+ for (const c of d) {
216
+ const a = `${s}/${c.name}`, l = r ? `${r}/${c.name}` : c.name;
217
+ if (!c.isDirectory()) {
218
+ const f = `${e}_${i}/${l}`.replace(/\\/g, "/"), u = c.name.endsWith(".js") ? "application/javascript" : c.name.endsWith(".css") ? "text/css" : "application/octet-stream";
216
219
  console.info(`âš™ī¸ Uploading '${l}' → '${f}'...`);
217
- const { stderr: u } = await w(`wrangler r2 object put "${f}" --file="${c}" --content-type ${p} --jurisdiction=eu --remote`);
218
- if (u) throw new Error(u);
220
+ const { stderr: p } = await y(`wrangler r2 object put "${f}" --file="${a}" --content-type ${u} --jurisdiction=eu --remote`);
221
+ if (p) throw new Error(p);
219
222
  }
220
223
  }
221
224
  }
@@ -225,18 +228,18 @@ async function U(e) {
225
228
  }
226
229
  }
227
230
  export {
228
- j as buildConfig,
229
- k as buildConnectorConfig,
230
- J as buildContextConfig,
231
- R as buildPresenterConfig,
231
+ k as buildConfig,
232
+ J as buildConnectorConfig,
233
+ A as buildContextConfig,
234
+ F as buildPresenterConfig,
232
235
  C as buildPublicDirectoryIndex,
233
- A as bumpVersion,
234
- F as echoScriptNotImplemented,
235
- D as insertLicensesIntoReadme,
236
+ R as bumpVersion,
237
+ D as echoScriptNotImplemented,
238
+ P as insertLicensesIntoReadme,
236
239
  I as insertOWASPDependencyCheckBadgeIntoReadme,
237
- P as sendDeploymentNotice,
238
- M as syncWithGitHub,
239
- T as uploadDirectoryToR2,
240
- _ as uploadModuleConfigToDO,
241
- U as uploadModuleToR2
240
+ M as sendDeploymentNotice,
241
+ T as syncWithGitHub,
242
+ _ as uploadDirectoryToR2,
243
+ W as uploadModuleConfigToDO,
244
+ B as uploadModuleToR2
242
245
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-development",
3
- "version": "0.3.127",
3
+ "version": "0.3.129",
4
4
  "description": "A library of utilities for managing the Data Positioning repositories.",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Terrell <terrell.jm@gmail.com>",